package com.lf.api.service;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
@CacheConfig(cacheNames="timestamp")
public class TestServiceImpl implements TestService {

	@Override
	@Cacheable(key = "'userId_' + #userId")
	public String queryTimestamp(int userId) {
		System.out.println("I'm in queryTimestamp method!!!");
		return "time = " + System.currentTimeMillis();
	}
	
	@Override
	@Cacheable(key = "'username_' + #userId")
	public String queryUsername(int userId) {
		System.out.println("I'm in queryUsername method!!!");
		return "username_" + System.currentTimeMillis();
	}
}
